/** 
 * ================================================================================
 * 		Project		: Kompas Bola
 * 		File		: RequestDaoImpl.java
 * 		Description	: Implement RequestDao
 * 		Called		: MainActivity.java
 * ================================================================================
 * */
package com.kompas.bola.application.dao;

import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.kompas.bola.application.config.JSONParser;
import com.kompas.bola.application.config.XMLParser;
import com.kompas.bola.application.model.Content;
import com.kompas.bola.application.model.ContentDetail;
import com.kompas.bola.application.utils.Constants;

public class OnResponse implements OnRequest{
	int current_page 				= 1;
	/** =========================================================================== */
	@Override
	public String getUrl(String command,String kanal,String type,String format,int page,
			String subkanal,boolean paramBoolean) {
		// TODO Auto-generated method stub
		String latestUrl 			= Constants.EMPTY;
		String pageValue 			= String.valueOf(page);
		if(paramBoolean){
			if(Constants.EMPTY.equalsIgnoreCase(subkanal)){
				latestUrl			= Constants.URL.replace("{command}", command).replace("{kanal}", kanal).replace("{type}", type).replace("{format}", format).replace("{page}", pageValue);				
			}else{
				latestUrl			= Constants.URL.replace("{command}", command).replace("{kanal}", kanal).replace("{type}", type).replace("{format}", format).replace("{page}", pageValue)+Constants.SUB_KANAL.replace("{subkanal}", subkanal);
			}
		}		
		return latestUrl;
	}
	/** =========================================================================== */
	@Override
	public String getLatestUrl(String command, String kanal,String type, String format,
			int page, String subkanal, boolean paramBoolean) {
		// TODO Auto-generated method stub
		String latestUrl 			= Constants.EMPTY;
		String pageValue 			= String.valueOf(page);
		if(paramBoolean){
			if(Constants.EMPTY.equalsIgnoreCase(subkanal)){
				latestUrl			= Constants.URL.replace("{command}", command).replace("{kanal}", kanal).replace("{type}", type).replace("{format}", format).replace("{page}", pageValue).replace(String.valueOf(Constants.LIMIT), Constants.CONTENT_LENGTH);				
			}else{
				latestUrl			= Constants.URL.replace("{command}", command).replace("{kanal}", kanal).replace("{type}", type).replace("{format}", format).replace("{page}", pageValue)+Constants.SUB_KANAL.replace("{subkanal}", subkanal);
			}
		}		
		return latestUrl;
	}
	/** =========================================================================== */
	@Override
	public String getDetailUrl(String kanal,String type, String guid,String format,boolean paramBoolean) {
		// TODO Auto-generated method stub
		String detailUrl 			= Constants.EMPTY;
		String _getGuid				= (guid != Constants.EMPTY ? guid : Constants.EMPTY);
		if(paramBoolean){
			detailUrl				= Constants.DETAIL_URL.replace("{kanal}", kanal).replace("{type}", type).replace("{command}", _getGuid).replace("{format}", format);
		}		
		return (detailUrl != null ? detailUrl : Constants.EMPTY);
	}	
	/** =========================================================================== */
	@Override
	public String getKlasemenUrl(String kanal,String type, String liga, String format,
			boolean paramBoolean) {
		// TODO Auto-generated method stub
		String klasemenlUrl			= Constants.EMPTY;
		String _getLiga				= (liga != Constants.EMPTY ? liga : Constants.EMPTY);
		if(paramBoolean){
			klasemenlUrl			= Constants.STAT_CONTENT.replace("{kanal}", kanal).replace("{type}", type).replace("{liga}", _getLiga).replace("{format}", format);
		}		
		return klasemenlUrl;
	}
	/** =========================================================================== */
	@Override
	public String getRelatedUrl(String kanal,String type, String guid,String format,
			boolean paramBoolean) {
		// TODO Auto-generated method stub
		String relatedUrl 			= Constants.EMPTY;
		if(paramBoolean){
			relatedUrl				= Constants.RELATED_URL.replace("{kanal}", kanal).replace("{type}", type).replace("{command}", guid).replace("{format}", format);
		}
		return relatedUrl;
	}	
	/** =========================================================================== */
	@Override
	public String getUpdateUrl(String command,String kanal,String type, String pubDate, String format,
			String subkanal,boolean paramBoolean) {
		// TODO Auto-generated method stub
		String updateUrl 			= Constants.EMPTY;
		if(paramBoolean){
			if(Constants.EMPTY.equalsIgnoreCase(subkanal)){
				updateUrl			= Constants.UPDATE_URL.replace("{command}", command).replace("{kanal}", kanal).replace("{type}", type).replace("{format}", format).replace("{pubDate}", pubDate);				
			}else{
				updateUrl			= Constants.UPDATE_URL.replace("{command}", command).replace("{kanal}", kanal).replace("{type}", type).replace("{format}", format).replace("{pubDate}", pubDate)+Constants.SUB_KANAL.replace("{subkanal}", subkanal);
			}
		}		
		return updateUrl;
	}
	/** =========================================================================== */	
	@Override
	public List<Content> getAll(String kanal, int page) {
		// TODO Auto-generated method stub
		JSONObject latest 			= null;
		JSONArray items 			= null;
		JSONObject json				= null;		
		
		JSONParser jParser 			= new JSONParser();		
		if(Constants.EMPTY.equalsIgnoreCase(kanal)){
			if(getLatestUrl(Constants.COMMAND_GET_LATEST,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,Constants.EMPTY,true) != null){
				json 				= jParser.getJSONFromUrl(getLatestUrl(Constants.COMMAND_GET_LATEST,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,Constants.EMPTY,true));				
			}else{
				json				= null;
			}	
		}else{
			if(getLatestUrl(Constants.COMMAND_GET_SUBRIK,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,kanal,true) != null){
				json 				= jParser.getJSONFromUrl(getLatestUrl(Constants.COMMAND_GET_SUBRIK,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,kanal,true));				
			}else{
				json				= null;
			}
		}	
		
		List<Content> list_data 	= new ArrayList<Content>();
		
		try {

			if(Constants.EMPTY.equalsIgnoreCase(kanal)){
				try {
					if(json != null){
						latest		= json.getJSONObject(Constants.TAG_LATEST);
					}else{
						latest		= null;
					}					
				} catch (JSONException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}				
			}else{
				try {
					if(json != null){
						latest		= json.getJSONObject(kanal);
					}else{
						latest		= null;
					}					
				} catch (JSONException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}					
			}
			
			try {
				if(latest != null){
					items			= latest.getJSONArray(Constants.TAG_ITEM);
				}else{
					items			= null;
				}				
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			if(items != null){
				for(int i = 0; i < items.length(); i++){
					Content bola 	= new Content();
					JSONObject c 	= items.getJSONObject(i);
					
					bola.setKEY_GUID(c.getString(Constants.GUID));
					bola.setKEY_TITLE(c.getString(Constants.TITLE));
					bola.setKEY_DESC(c.getString(Constants.DESC));
					bola.setKEY_PUB_DATE(c.getString(Constants.PUBDATE));
					bola.setKEY_THUMB_URL(c.getString(Constants.THUMB));
					bola.setKEY_PHOTO_URL(c.getString(Constants.PHOTO));
					
					list_data.add(bola);
				}
			}else{
				list_data.isEmpty();
			}				
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		return list_data;
	}
	
	/** =========================================================================== */	
	@Override
	public List<Content> getListUrlJson(String kanal, int page) {
		// TODO Auto-generated method stub
		JSONObject latest 			= null;
		JSONArray items 			= null;
		JSONObject json				= null;		
		
		JSONParser jParser 			= new JSONParser();		
		if(Constants.EMPTY.equalsIgnoreCase(kanal)){
			if(getUrl(Constants.COMMAND_GET_LATEST,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,Constants.EMPTY,true) != null){
				try {
					json 			= jParser.getJSONFromUrl(getUrl(Constants.COMMAND_GET_LATEST,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,Constants.EMPTY,true));
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}else{
				json				= null;
			}				
		}else{
			if(getUrl(Constants.COMMAND_GET_SUBRIK,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,kanal,true) != null){
				try {
					json 			= jParser.getJSONFromUrl(getUrl(Constants.COMMAND_GET_SUBRIK,Constants.BOLA,Constants.TYPE_LIST,Constants.FORMAT_JSON,page,kanal,true));
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}	
			}else{
				json				= null;
			}			
		}	
		
		List<Content> list_data 	= new ArrayList<Content>();
		
		try {

			if(Constants.EMPTY.equalsIgnoreCase(kanal)){
				if(json != null){
					try {
						latest		= json.getJSONObject(Constants.TAG_LATEST);
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}else{
					latest			= null;
				}
								
			}else{
				if(json != null){
					try {
						latest		= json.getJSONObject(kanal);
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}else{
					latest			= null;
				}
									
			}
			
			if(latest != null){
				try {
					items			= latest.getJSONArray(Constants.TAG_ITEM);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}else{
				items				= null;
			}
			
			if(items != null){
				for(int i = 0; i < items.length(); i++){
					Content bola 	= new Content();
					JSONObject c 	= items.getJSONObject(i);
					
					bola.setKEY_GUID(c.getString(Constants.GUID));
					bola.setKEY_TITLE(c.getString(Constants.TITLE));
					bola.setKEY_DESC(c.getString(Constants.DESC));
					bola.setKEY_PUB_DATE(c.getString(Constants.PUBDATE));
					bola.setKEY_THUMB_URL(c.getString(Constants.THUMB));
					bola.setKEY_PHOTO_URL(c.getString(Constants.PHOTO));
					
					list_data.add(bola);
				}
			}else{
				
				list_data.isEmpty();
			}				
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return list_data;
	}
	/** =========================================================================== */
	@Override
	public List<ContentDetail> getListComment(String guid, int page) {
		// TODO Auto-generated method stub
		JSONObject xml	 			= null;
		JSONObject comment 			= null;
		JSONArray items 			= null;
		JSONObject json				= null;		
		String _getGuid				= (guid != null ? guid : Constants.EMPTY);
		
		JSONParser jParser 			= new JSONParser();	
		if(getDetailUrl(Constants.BOLA,Constants.TYPE_COMMENT,_getGuid,Constants.FORMAT_JSON, true) != null){
			try {
				json 				= jParser.getJSONFromUrl(getDetailUrl(Constants.BOLA,Constants.TYPE_COMMENT,_getGuid,Constants.FORMAT_JSON, true));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else{
			json					= null;
		}

		List<ContentDetail> list_data= new ArrayList<ContentDetail>();
		
		try {
			if(json != null){
				try {
					xml				= json.getJSONObject(Constants.FORMAT_XML);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}else{
				xml				= null;
			}
			
			if(xml != null){
				try {
					comment			= xml.getJSONObject(Constants.TYPE_COMMENT);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}else{
				comment				= null;
			}			

			if(comment != null){
				try {
					items			= comment.getJSONArray(Constants.TAG_ITEM);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					items				= null;
				}
			}else{
				items				= null;
			}

			if(items != null){
				for(int i = 0; i < items.length(); i++){
					ContentDetail bolaDetail 	= new ContentDetail();
					JSONObject c 	= items.getJSONObject(i);
					
					bolaDetail.setCOMMENT_ID(c.getString(Constants.COMMENT_ID));
					bolaDetail.setUSER_ID(c.getString(Constants.USER_ID));
					bolaDetail.setUSER_NAME(c.getString(Constants.USER_NAME));
					bolaDetail.setPROFILE_PICTURE(c.getString(Constants.PROFILE_PICTURE));
					bolaDetail.setCOMMENT(c.getString(Constants.TYPE_COMMENT));
					bolaDetail.setPUB_DATE(c.getString(Constants.PUBDATE));
					
					list_data.add(bolaDetail);
				}
			}else{				
				list_data.isEmpty();
			}
			
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return list_data;
	}
	/** =========================================================================== */
	@Override
	public ContentDetail getDetailUrlXml(String guid) {
		// TODO Auto-generated method stub
		ContentDetail bolaDetail 	= new ContentDetail();
		XMLParser parser 			= new XMLParser();
		String xml					= Constants.EMPTY;
		String _getGuid				= (guid != null ? guid : Constants.EMPTY);
		
		if(parser.getXmlFromUrl(getDetailUrl(Constants.BOLA,Constants.TYPE_READ,_getGuid,Constants.FORMAT_XML, true) != Constants.EMPTY ? getDetailUrl(Constants.BOLA,Constants.TYPE_READ,_getGuid,Constants.FORMAT_XML, true) : Constants.EMPTY) != Constants.EMPTY){
			try {
				xml 				= parser.getXmlFromUrl(getDetailUrl(Constants.BOLA,Constants.TYPE_READ,_getGuid,Constants.FORMAT_XML, true));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else{
			xml						= null;
		}
		
		Document doc 				= null;
		if(xml != null){
			try {
				doc 				= parser.getDomElement(xml);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}			
		}else{
			doc						= null;
		}
		
		if(doc != null){
			/** 
			 * GET PARAGRAPH DETAIL */
			NodeList pargph			= doc.getElementsByTagName(Constants.BODY_CONTENT);
			for (int i = 0; i < pargph.getLength(); i++) {
				Element e 			= (Element) pargph.item(i);	
				bolaDetail.setPARAGRAPH(parser.getValue(e, Constants.PARAGRAPH));	
			}	
			
			/** 
			 * GET PUBLISHEDBY-AUTHOR DETAIL */
			NodeList author			= doc.getElementsByTagName(Constants.NEWS_COMPONENT);
			for (int i = 0; i < author.getLength(); i++) {
				Element e 			= (Element) author.item(1);	
				
				bolaDetail.setDATELINE(parser.getValue(e, Constants.DATELINE));
				bolaDetail.setPUBLISHEDBY(parser.getValue(e, Constants.PUBLISHED_BY));	
				bolaDetail.setAUTHOR(parser.getValue(e, Constants.AUTHOR));	
			}	

			/** 
			 * GET NEWSLINE	 */
			NodeList newsline		= doc.getElementsByTagName(Constants.NEWS_LINE);
			for (int i = 0; i < newsline.getLength(); i++) {
				Element e 			= (Element) newsline.item(1);	
				
				bolaDetail.setHEAD_LINE(parser.getValue(e, Constants.HEAD_LINE));
				bolaDetail.setSHORTENLINK(parser.getValue(e, Constants.SHORTENLINK));	
			}	

			/** 
			 * GET ATTRIBUT MEDIA REFERENCE DETAIL */
			NodeList reference		= doc.getElementsByTagName(Constants.MEDIA_REFERENCE);
			for (int i = 0; i < reference.getLength(); i++) {
				Element e 			= (Element) reference.item(i);	
				bolaDetail.setSOURCE(e.getAttribute(Constants.SOURCE));	
			}	

			/** 
			 * GET ATTRIBUT NEWS ITEM TYPE */
			NodeList type			= doc.getElementsByTagName(Constants.NEWS_TYPE);
			for (int i = 0; i < type.getLength(); i++) {
				Element e 			= (Element) type.item(i);	
				bolaDetail.setNEWS_TYPE(e.getAttribute(Constants.FORMAL_NAME));
			}	

			/** 
			 * GET RELATED ITEM */
			NodeList related		= doc.getElementsByTagName(Constants.ITEM);
			List<String> list_title_related = new ArrayList<String>();
			List<String> list_guid_related = new ArrayList<String>();
			for (int i = 0; i < related.getLength(); i++) {
				Element e 			= (Element) related.item(i);
				
				list_title_related.add(parser.getValue(e, Constants.TITLE));
				list_guid_related.add(parser.getValue(e, Constants.GUID));
				
			}		
			bolaDetail.setLIST_TITLE_RELATED(list_title_related);
			bolaDetail.setLIST_GUID_RELATED(list_guid_related);	
		}else{
			bolaDetail				= null;
		}
		
		return bolaDetail;
	}
	/** =========================================================================== */
	@Override
	public List<Content> getKlasemenXml(String liga) {
		// TODO Auto-generated method stub
		XMLParser parser 			= new XMLParser();
		String xml					= Constants.EMPTY;
		String _getLiga				= (liga != null ? liga : Constants.EMPTY);

		if(parser.getXmlFromUrl(getKlasemenUrl(Constants.BOLA,Constants.TYPE_STAT_BOLA,_getLiga,Constants.FORMAT_XML, true) != Constants.EMPTY ? getDetailUrl(Constants.BOLA,Constants.TYPE_READ,_getLiga,Constants.FORMAT_XML, true) : Constants.EMPTY) != Constants.EMPTY){
			try {
				xml 				= parser.getXmlFromUrl(getKlasemenUrl(Constants.BOLA,Constants.TYPE_STAT_BOLA,_getLiga,Constants.FORMAT_XML, true));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else{
			xml						= null;
		}

		Document doc 				= null;
		if(xml != null){
			try {
				doc 				= parser.getDomElement(xml);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}			
		}else{
			doc						= null;
		}

		List<Content> list_data 	= new ArrayList<Content>();
		
		if(doc != null){
			if(_getLiga.equalsIgnoreCase(Constants.AGENDA)){
				NodeList jadwal		= doc.getElementsByTagName(Constants.ITEM);

				for (int i = 0; i < jadwal.getLength(); i++) {
					Element e 		= (Element) jadwal.item(i);

					Content bola 	= new Content();

					/** 
					 * GET JADWAL */
					bola.setKEY_DESC(e.getAttribute(Constants.NAME_ALIAS));
					bola.setKEY_DATE(parser.getValue(e, Constants.DATE));
					bola.setKEY_TEAM1(parser.getValue(e, Constants.TEAM1));
					bola.setKEY_TEAM2(parser.getValue(e, Constants.TEAM2));
					bola.setKEY_LIGA(parser.getValue(e, Constants.LIGA));
					bola.setKEY_TV(parser.getValue(e, Constants.TV));
					bola.setKEY_TIME(parser.getValue(e, Constants.TIME));

					list_data.add(bola);
				}
			}else{
				/** 
				 * GET KLASEMEN */
				NodeList tim		= doc.getElementsByTagName(Constants.TIM);
				NodeList match		= doc.getElementsByTagName(Constants.ITEM);
				NodeList team1		= doc.getElementsByTagName(Constants.TEAM1);
				NodeList team2		= doc.getElementsByTagName(Constants.TEAM2);
				NodeList topskor	= doc.getElementsByTagName(Constants.TOPSCORE);
				Element h 			= (Element) topskor.item(0);
				NodeList _getItem	= h.getElementsByTagName(Constants.ITEM);	
				
				for (int i = 0; i < tim.getLength(); i++) {
					Element d 		= (Element) tim.item(i);
					Element e 		= (Element) match.item(i);
					Element f 		= (Element) team1.item(i);
					Element g 		= (Element) team2.item(i);	
					Element j 		= (Element) _getItem.item(i);			
					
					Content bola 	= new Content();
					
					/** 
					 * GET KLASEMEN */
					bola.setKEY_TIM(d.getAttribute(Constants.NAME_ALIAS));
					bola.setKEY_PLAY(parser.getValue(d, Constants.PLAY));
					bola.setKEY_WIN(parser.getValue(d, Constants.WIN));
					bola.setKEY_DRAW(parser.getValue(d, Constants.DRAW));
					bola.setKEY_LOSE(parser.getValue(d, Constants.LOSE));
					bola.setKEY_GOL_WIN(parser.getValue(d, Constants.GOL_WIN));
					bola.setKEY_GOL_LOSE(parser.getValue(d, Constants.GOL_LOSE));
					bola.setKEY_POINT(parser.getValue(d, Constants.POINT));				

					/** 
					 * GET MATCH */
					bola.setKEY_DATE(parser.getValue(e, Constants.DATE));
					bola.setKEY_GAME_STATUS(parser.getValue(e, Constants.GAME_STATUS));
					bola.setKEY_TEAM1(parser.getValue(e, Constants.TEAM1));
					bola.setKEY_TEAM2(parser.getValue(e, Constants.TEAM2));

					/** 
					 * GET TEAM1 */
					bola.setKEY_SCORE1(f.getAttribute(Constants.SCORE_RESULT));	

					/** 
					 * GET TEAM2 */
					bola.setKEY_SCORE2(g.getAttribute(Constants.SCORE_RESULT));
					
					/** 
					 * GET TOPSCORE */
					bola.setKEY_PLAYER(parser.getValue(j, Constants.PLAYER));
					bola.setKEY_GOL(parser.getValue(j, Constants.GOL));
					
					list_data.add(bola);
				}				
			}		
		}else{
			list_data.isEmpty();
		}
		
		return list_data;
	}
	/** =========================================================================== */
	@Override
	public Content getUpdateNews(String pubDate) {
		// TODO Auto-generated method stub				
		XMLParser parser 			= new XMLParser();
		Content bola		 		= new Content();
		String xml					= Constants.EMPTY;
		String _getPubdate			= pubDate.replace("-", Constants.EMPTY).replace(" ", Constants.EMPTY).replace(":", Constants.EMPTY);
				
		if(getUpdateUrl(Constants.COMMAND_GET_LATEST,Constants.BOLA,Constants.TYPE_NEWEST, _getPubdate,Constants.FORMAT_XML,Constants.EMPTY,true) != null){
			try {
				xml 				= parser.getXmlFromUrl(getUpdateUrl(Constants.COMMAND_GET_LATEST,Constants.BOLA,Constants.TYPE_NEWEST, _getPubdate,Constants.FORMAT_XML,Constants.EMPTY,true));
			} catch (Exception e) {
				// TODO Auto-generated catch block
				xml					= null;
			}
		}else{
			xml						= null;
		}				

		Document doc 				= null;
		
		if(xml != null){
			try {
				doc 				= parser.getDomElement(xml.toString());
			} catch (Exception e) {
				// TODO Auto-generated catch block
				doc					= null;
			}			
		}else{
			doc						= null;
		}

		if(doc != null){
			/** 
			 * GET PARAGRAPH DETAIL */
			NodeList pargph			= doc.getElementsByTagName(Constants.TYPE_NEWEST);
			for (int i = 0; i < pargph.getLength(); i++) {
				Element e 			= (Element) pargph.item(i);	
				bola.setKEY_TOTAL(parser.getValue(e, Constants.TOTAL));	
				bola.setKEY_MESSAGE(parser.getValue(e, Constants.MESSAGE));
			}			
		}		
		
		return bola;
	}
	/** =========================================================================== */
}
